*** Settings ***
Test Setup        common_test_setup    @{consignor_menu}
Test Teardown     Run Keyword If Test Failed    common_test_teardown
Resource          ../../resource/cluemanage/consignor_resource.txt
Resource          ../../testdata/${testenv}/cluemanage/consignorclue.txt

*** Test Cases ***
create_suc
    [Documentation]    创建成功(已没有这个功能)
    [Tags]    level1    not run
    ${now}    get time    epoch
    ${name}    catenate    SEPARATOR=_    @{consignor_add_succ}[1]    ${now}
    add_clue    ${name}    1${now}    @{consignor_add_succ}[2]    @{consignor_add_succ}[3]    @{consignor_add_succ}[4]
    check_msg    保存成功
    wait_table_loaded
    check_table    @{consignor_add_succ}[0]    ${name}
    Set Suite Variable    ${consignor_cluename}    ${name}

clue_modify
    [Documentation]    修改线索成功
    [Tags]    level1
    @{t}    Copy List    ${crm_consignor_modify}
    @{l1}    evaluate    list(@{t})[1:4]
    @{l2}    evaluate    list(@{t})[4:]
    kw_crm_search_consignorclue    @{l1}
    kw_crm_consignorclue_modify_new    @{l2}
    check_msg    修改成功
    kw_crm_check_table    @{t}[0]    @{l1}
    kw_crm_consignorclue_modify_check    @{l2}

clue_allocate
    [Documentation]    指派线索-成功
    [Tags]    level1
    @{t}    Copy List    ${crm_consignor_allocate}
    @{l1}    juma_string_to_json    @{t}[0]
    @{l2}    juma_string_to_json    @{t}[1]
    kw_crm_consignorclue_allocate_new    ${l1}    @{t}[3]
    check_msg    分配线索成功
    wait_table_loaded
    kw_crm_check_table    @{t}[2]    @{l2}

clue_release
    [Documentation]    释放-成功
    [Tags]    level1
    @{t}    Copy List    ${crm_consignor_release}
    @{l1}    juma_string_to_json    @{t}[0]
    @{l2}    juma_string_to_json    @{t}[1]
    kw_crm_consignorclue_release_new    ${l1}
    wait_table_loaded
    kw_crm_check_table    @{t}[2]    @{l2}

clue_claim
    [Documentation]    认领-成功
    [Tags]    level1    not run
    consignorclue_claim
    wait_table_loaded
    check_table    @{consignor_claim}[0]

clue_close
    [Documentation]    关闭线索-成功
    [Tags]    level1
    @{t}    Copy List    ${crm_consignor_close}
    @{l1}    juma_string_to_json    @{t}[0]
    @{l2}    juma_string_to_json    @{t}[1]
    @{l3}    juma_string_to_json    @{t}[6]
    kw_crm_consignorclue_allocate_new    ${l1}    @{t}[5]
    wait_table_loaded
    kw_crm_consignorclue_close_new    ${l3}    @{t}[4]    @{t}[3]
    wait_table_loaded
    kw_crm_check_table    @{t}[2]    @{l2}

clue_recovery
    [Documentation]    恢复线索-成功
    [Tags]    level1
    @{t}    Copy List    ${crm_consignor_recovery}
    @{l1}    juma_string_to_json    @{t}[0]
    @{l2}    juma_string_to_json    @{t}[1]
    kw_crm_consignorclue_recovery    @{l1}
    wait_table_loaded
    kw_crm_check_table    @{t}[2]    @{l2}

clue_follow
    [Documentation]    跟进-成功
    [Tags]    level1    not run
    comment    需要再认领一次
    consignorclue_claim
    wait_table_loaded
    @{l}    evaluate    list(@{consignor_follow})[1:]
    consignorclue_follow    @{l}
    check_msg    跟进成功
    wait_table_loaded
    check_table    @{consignor_follow}[0]

clue_follow_deposit
    [Documentation]    跟进到试运行（最后一个状态）-成功
    [Tags]    level1    not run
    @{l}    evaluate    list(@{consignor_follow_deposit})[1:]
    consignorclue_follow_deposit    @{l}
    wait_table_loaded
    check_table    @{consignor_follow_deposit}[0]

clue_export
    [Tags]    level1
    Click Menu Into Page    CRM管理    导出任务管理    导出任务
    wait_table_loaded
    ${count1}    get_table_result_count
    Click Menu Into Page    @{consignor_menu}
    export    ${True}    确认    ${True}    线索名称,渠道来源    确定
    Click Menu Into Page    CRM管理    导出任务管理    导出任务
    wait_table_loaded
    ${count2}    get_table_result_count
    ${tmpcount}    evaluate    int(${count1})+1
    Should Be Equal As Integers    ${tmpcount}    ${count2}
